import type { ClassValue } from 'clsx'
import { clsx } from 'clsx'
import { twMerge } from 'tailwind-merge'

export function cn(...inputs: ClassValue[]) {
    return twMerge(clsx(inputs))
}

export function resolveRoutePath(basePath?: string, routePath?: string) {
    if (!basePath) return routePath ?? ''
    
    // 简单的路径拼接，避免使用path-browserify
    const cleanBasePath = basePath.replace(/\/$/, '')
    const cleanRoutePath = (routePath ?? '').replace(/^\//, '')
    
    return cleanRoutePath ? `${cleanBasePath}/${cleanRoutePath}` : cleanBasePath
}
